<template>
	<view>
		<view class="list-item">
			<slot name="preLeft"></slot>
			<view class="left">
				<image :src="item.image" mode="widthFix"></image>
			</view>
			<view class="right">
				<view class="title">{{item.title}}</view>

				<slot name="word">
					<view class="word">
						{{item.word}}
					</view>
				</slot>

				<view class="btm">
					<text class="price">单价： {{item.price}}</text>
					<text>{{ item.type }}</text>
					<text class="sell">销售： {{item.sell | sell}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "list-item",
		props: {
			item: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {

			};
		},
		filters: {
			sell(count) {
				if (count > 10000) return Math.floor((count / 10000)) + '万+'
				if (count > 1000) return Math.floor((count / 1000)) + '千+'
				return count
			}
		},
	}
</script>


<style lang="scss" scoped>
	@import '../../static/scss/common.scss';

	.list-item {
		display: flex;

		.left {
			image {
				width: 300upx;
				height: 240upx;
			}
		}

		.right {
			margin-left: 12upx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;

			.title {
				font-weight: bold;
				font-size: 40upx;
			}

			.word {
				@include line(2);
			}

			.btm {
				display: flex;
				justify-content: space-between;
				font-size: 24upx;
			}
		}
	}
</style>